package com.han.fu.api.common.enums;

import com.han.fu.api.common.model.ResponseVo;
import lombok.Getter;

/**
 * 权限控制枚举
 *
 * @author: star
 * @date: 2021-07-31
 */
public enum SecurityEnum {

    /**
     * 权限控制枚举
     */
    AUTH_FAIL(401, "认证失败"),
    PERMISSION_DENIED(403, "禁止访问");

    @Getter
    private int code;

    @Getter
    private String msg;

    SecurityEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static void setResponseVo(ResponseVo responseVo, SecurityEnum securityEnum) {
        responseVo.setCode(securityEnum.getCode());
        responseVo.setMessage(securityEnum.getMsg());
    }

}
